import { createApp } from "vue";
import Antd from 'ant-design-vue';
import App from "./App.vue";
import "ant-design-vue/dist/reset.css";
import "@/theme/index.less";
import * as antIcons from "@ant-design/icons-vue";
import privilegePlugin from '@/plugins/privilege-plugin';
import smartEnumPlugin from '@/plugins/smart-enums-plugin';
import constantsInfo from '@/constants/index';

import { createPinia } from "pinia";
// 数据持久化插件
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
//routes
import { router } from "@/router/index";
const app = createApp(App);
// 注册图标组件
Object.keys(antIcons).forEach((key) => {
  app.component(key, (antIcons as any)[key]);
});
// 对vue进行类型补充说明 不然全局方法 TS会报错
declare module '@vue/runtime-core' {
  interface ComponentCustomProperties {
    $antIcons: any
    $smartEnumPlugin:any
    $privilege:any
  }
}
//全局
app.config.globalProperties.$antIcons = antIcons;
app.use(router);
app.use(createPinia().use(piniaPluginPersistedstate));
//@ts-ignore
app.use(Antd).use(smartEnumPlugin, constantsInfo).use(privilegePlugin);
app.mount("#app");
